package br.com.estevam.sisfin.pages;

import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.RequestGlobals;
import org.apache.tapestry5.services.Session;

import br.com.estevam.sisfin.data.Visit;

public class Logoff {

	@SessionState
	private Visit visit;

	@Inject
	private RequestGlobals requestGlobals;

	Class<Index> onActivate(){
		Session session = requestGlobals.getRequest().getSession(false);
		if(session != null){
			visit = null;
			session.invalidate();
		}
		
		return Index.class;
	}
	
	public Visit getVisit() {
		return visit;
	}

	public void setVisit(Visit visit) {
		this.visit = visit;
	}
}
